package com.yunxi.service.dubboService.impl;

import com.codingapi.txlcn.tc.annotation.LcnTransaction;
import com.github.pagehelper.PageInfo;
import com.yunxi.base.pojo.BaseApplyLevelVO;
import com.yunxi.base.service.BaseApplyLevelDubboService;
import com.yunxi.model.base.BaseApplyLevel;
import com.yunxi.service.localService.BaseApplyLevelService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.transaction.annotation.Transactional;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author caoYong
 * @since 2019-07-23
 */
public class BaseApplyLevelDubboServiceImpl implements BaseApplyLevelDubboService {

    @Autowired
    @Qualifier(value = "baseApplyLevelServiceImpl")
    BaseApplyLevelService baseApplyLevelService;


    @Override
    @Transactional
    @LcnTransaction
    public BaseApplyLevelVO getById(String id) throws InvocationTargetException, IllegalAccessException {
    BaseApplyLevel baseApplyLevel = baseApplyLevelService.getById(id);
    BaseApplyLevelVO baseApplyLevelVO = new BaseApplyLevelVO();
        BeanUtils.copyProperties(baseApplyLevel,baseApplyLevelVO);
        return baseApplyLevelVO;
    }

    @Override
    @Transactional
    @LcnTransaction
    public void saveOrUpdate(BaseApplyLevelVO baseApplyLevelVO) throws InvocationTargetException, IllegalAccessException {
        BaseApplyLevel baseApplyLevel = new BaseApplyLevel();
        BeanUtils.copyProperties(baseApplyLevelVO,baseApplyLevel);
        baseApplyLevelService.saveOrUpdate(baseApplyLevel);
    }

    @Override
    @Transactional
    @LcnTransaction
    public void removeById(String id) {
    baseApplyLevelService.removeById(id);
    }

    @Override
    @Transactional
    @LcnTransaction
    public PageInfo<BaseApplyLevelVO> findPageByVO(BaseApplyLevelVO baseApplyLevelVO, Integer pageNum, Integer pageSize) throws InvocationTargetException, IllegalAccessException {
      PageInfo<BaseApplyLevelVO> pageInfo = baseApplyLevelService.pageByVo(baseApplyLevelVO,pageNum,pageSize);
      return pageInfo;
   }

    @Override
    @Transactional
    @LcnTransaction
    public void removeByListVo(List<BaseApplyLevelVO> baseApplyLevelVOList) throws IllegalAccessException, InvocationTargetException, InstantiationException {
        baseApplyLevelService.removeByListVo(baseApplyLevelVOList);
    }

    @Override
    @Transactional
    @LcnTransaction
    public List listByVo(BaseApplyLevelVO baseApplyLevelVO) {
      return baseApplyLevelService.listByVo(baseApplyLevelVO);
    }
}
